<template>
	<view>
		<view style="height: 570rpx;width: 100%;">
			<view class="back">
			</view>
			<view class="hotbox">
				<view class="title">最近热门：</view>
				<view class="unibox1" v-for="(item,index) in hotList" :value="index" @click="gotogroup(item)">
					<image :src="item.portraitURL"></image>
					<view class="contentbox">
						<view class="namebox">{{item.school}}</view>
						<view class="hotpost">[新帖]{{item.topicList[0]}}</view>
						<view class="newpost">[热帖]{{item.resourceList[0]}}</view>
					</view>
				</view>
			</view>
		</view>
		<view style="font-weight: bold; font-size: 35rpx;margin-left: 20rpx;">其他圈子：</view>
		<!-- <view class="otherbox"> -->
		<view class="unibox2" v-for="(item,index) in groupList" :value="index" @click="gotogroup(item)">
			<image :src="item.portraitURL"></image>
			<view class="contentbox">
				<view class="namebox">{{item.school}}</view>
				<view class="hotpost">[新帖]{{item.topicList[0]}}</view>
				<view class="newpost">[热帖]{{item.resourceList[0]}}</view>
			</view>
		</view>
		<!-- </view> -->
	</view>
</template>

<script>
	export default {
		onLoad() {
			this.getGroupList()
		},
		onShow() {
		},
		data() {
			return {
				hotList: [],
				groupList: [],
				hotlist: [1, 2],
				otherlist: [1, 2, 3, 4, 5, 6, 7]
			};
		},
		methods: {
			getGroupList() {
				uni.request({
				    url: this.baseurl + '/getGroupList',
					data: {

					},
				    success: (res) => {
						this.hotList = res.data.hotList;
						console.log(res.data.hotList);
						this.groupList = res.data.groupList;
						console.log(res.data.topicList);
				    }
				});
			},
			gotogroup(item) {
				uni.navigateTo({
					url: "../circle/UniversityMsg" + "?groupId=" + item.groupId
				})
			},
		}
	}
</script>

<style lang="scss">
	.back {
		background-color: #C0E9FF;
		height: 450rpx;
	}

	.hotbox {
		background-color: #FFFFFF;
		border: 1rpx solid #C8C7CC;
		height: 400rpx;
		width: 650rpx;
		margin-left: 50rpx;
		position: relative;
		top: -330rpx;
		border-radius: 20rpx;
		display: flex;
		flex-direction: column;

		.title {
			//background-color: #007AFF;
			font-weight: bold;
			margin-left: 20rpx;
			margin-top: 20rpx;
			height: 70rpx;
			font-size: 35rpx;
		}

		.unibox1 {
			display: flex;
			height: 155rpx;
			flex-direction: row;
			align-items: center;

			image {
				margin-left: 20rpx;
				height: 130rpx;
				width: 130rpx;
				border-radius: 20rpx;
			}

			.contentbox {
				display: flex;
				flex-direction: column;
				flex: 1;
				//width: 300rpx;
				//background-color: #2C405A;
				height: 155rpx;

				.namebox {
					margin-top: 10rpx;
					font-weight: bold;
				}

				.hotpost {
					//color: #DD524D;
					//font-size: 30rpx;
					margin: 5rpx;
					font-size: 27rpx;
					color: #DD524D;
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
					width: 490rpx;
				}

				.newpost {
					margin: 5rpx;
					font-size: 27rpx;
					color: #808080;
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
					width: 490rpx;
				}
			}
		}
	}
	
	.unibox2 {
		display: flex;
		height: 155rpx;
		flex-direction: row;
		align-items: center;
	
		image {
			margin-left: 20rpx;
			height: 130rpx;
			width: 130rpx;
			border-radius: 20rpx;
		}
	
		.contentbox {
			display: flex;
			flex-direction: column;
			flex: 1;
			//width: 300rpx;
			//background-color: #2C405A;
			height: 155rpx;
	
			.namebox {
				margin-top: 10rpx;
				font-weight: bold;
			}
	
			.hotpost {
				//color: #DD524D;
				//font-size: 30rpx;
				margin: 5rpx;
				font-size: 27rpx;
				color: #DD524D;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
				width: 560rpx;
			}
	
			.newpost {
				margin: 5rpx;
				font-size: 27rpx;
				color: #808080;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
				width: 560rpx;
			}
		}
	}
</style>
